#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <bitset>
#include <utility>
using namespace std;

const double eps = 1e-6;
const int INF = 0x3f3f3f3f;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<int, LL> PIL;

inline void quickread()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

const int N = 1e5 + 10;

int l, r;
bool p[N];
int prime[N], idx;

unordered_set<int> st;

struct factor
{
    int x, cnt;
};

bool isPrime(int n)
{
    return !p[n];
}

int multi(int p, int e)
{
    int nult = 1;
    for (int i = 0; i <= e; i++)
        nult *= p;
    return nult;
}

int calc(int n)
{
    int t = n;
    int num = 0, sum = 1;
    factor fac[10];
    int sqr = (int)sqrt(n * 1.0);
    for (int i = 0; i < idx && prime[i] <= sqr; i++)
    {
        if (n % prime[i] == 0)
        {
            fac[num].x = prime[i];
            fac[num].cnt = 0;
            while (n % prime[i] == 0)
            {
                fac[num].cnt++;
                n /= prime[i];
            }
            num++;
        }
        if (n == 1)
            break;
    }
    if (n != 1)
    {
        fac[num].x = n;
        fac[num++].cnt = 1;
    }
    for (int i = 0; i < num; i++)
        sum *= ((1 - multi(fac[i].x, fac[i].cnt)) / (1 - fac[i].x));
    return sum - t;
}

inline void solution()
{
    memset(p, false, sizeof p);
    p[1] = true;
    for (int i = 2; i < N; i++)
    {
        if (p[i])
            continue;
        for (int k = 2; i * k < N; k++)
            p[i * k] = true;
    }

    memset(prime, 0, sizeof prime);
    for (int i = 1; i < N; i++)
    {
        if (isPrime(i) == true)
            prime[idx++] = i;
    }

    cin >> l >> r;
    int cnt = 0;
    for (int i = max(l, 2); i <= r; i++)
    {
        if (st.count(i)) continue;
        int n = calc(i);
        if (n < 0 || n > r) continue;
        int m = calc(n);
        if (m == i && i != n)
        {
            cout << i << " " << n << endl;
            st.insert(m);
            st.insert(n);
            cnt++;
        }
    }
    if (!cnt)
        cout << -1 << endl;

}

int main()
{
    freopen("input.txt", "r", stdin);
    quickread();
    solution();
    return 0;
}
